]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Notify service startup to systemd
authorBenjamin Berg <bberg@redhat.com>
Sun, 25 Aug 2019 05:26:12 +0000 (07:26 +0200)
committerFlorian Müllner <florian.muellner@gmail.com>
Tue, 27 Aug 2019 17:42:32 +0000 (17:42 +0000)
Using the bus name to notify service startup to systemd has some
disadvantages. The main one being that systemd will consider a
gnome-shell restart (Alt+F2 r) a service failure and restart the shell,
cleaning up all its children (i.e. user launched applications). In the
future the shell should launch applications in their own transient unit
so that a service restart does not affect applications.

Another potential issue is that we must never load
gnome-shell-wayland.service and gnome-shell-x11.service at the same
time, as systemd does not like two services providing the same bus
name.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/1496

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/690

data/gnome-shell-wayland.service.in
data/gnome-shell-x11.service.in
src/main.c

index 848a3ea3293fc90239f31f56b12263c7cd7c5aa8..351571c7fc3b1c4dfaecf1b5aaccdcf1866ac943 100644 (file)
@@ -17,10 +17,9 @@ Before=gnome-session-initialized.target
 #Conflicts=gnome-shell-x11.service
 
 [Service]
-Type=dbus
+Type=notify
 ExecStart=@bindir@/gnome-shell
 # Exit code 1 means we are probably *not* dealing with an extension failure
 SuccessExitStatus=1
 # On wayland we cannot restart
 Restart=no
-BusName=org.gnome.Shell
index 142f26b241bd7e80200c38d93b68258998cab00c..2c9fec1b5abdad4e466d5af2a49747a72e5ba654 100644 (file)
@@ -21,7 +21,7 @@ StartLimitIntervalSec=15s
 StartLimitBurst=3
 
 [Service]
-Type=dbus
+Type=notify
 ExecStart=@bindir@/gnome-shell
 # Exit code 1 means we are probably *not* dealing with an extension failure
 SuccessExitStatus=1
@@ -29,4 +29,3 @@ SuccessExitStatus=1
 Restart=always
 # Do not wait before restarting the shell
 RestartSec=0ms
-BusName=org.gnome.Shell
index 6faf9934fb67d31251ca30f0384325e8583195a2..8be1395f7099775649b38fedb92ee71abae8ddad 100644 (file)
 #include "shell-perf-log.h"
 #include "st.h"
 
+#ifdef HAVE_SYSTEMD
+#include <systemd/sd-daemon.h>
+#else
+/* So we don't need to add ifdef's everywhere */
+#define sd_notify(u, m)            do {} while (0)
+#define sd_notifyf(u, m, ...)      do {} while (0)
+#endif
+
 extern GType gnome_shell_plugin_get_type (void);
 
 #define SHELL_DBUS_SERVICE "org.gnome.Shell"
@@ -524,6 +532,7 @@ main (int argc, char **argv)
   shell_init_debug (g_getenv ("SHELL_DEBUG"));
 
   shell_dbus_init (meta_get_replace_current_wm ());
+  sd_notify (0, "READY=1");
   shell_a11y_init ();
   shell_perf_log_init ();
   shell_introspection_init ();